package com.aspose.cells;

class zix implements zagc {
   private zig c;
   private zat d;
   private zalw e;
   private com.aspose.cells.b.a.b.zg f;
   private zxp g;
   private boolean h;
   private Color i;
   private int j;
   private int k;
   private int l;
   private int m;
   com.aspose.cells.b.a.b.zp a = com.aspose.cells.b.a.b.zp.a();
   com.aspose.cells.b.a.b.zp b = com.aspose.cells.b.a.b.zp.a();
   private boolean n = true;
   private boolean o = true;
   private boolean p = true;
   private boolean q = true;
   private Object r = null;
   private int s;
   private int t;
   private int u;
   private int v;
   private boolean w = true;
   private boolean x = true;
   private boolean y = false;

   zix(zig var1, Object var2, int var3, int var4) {
      this.c = var1;
      this.l = 0;
      this.m = 0;
      this.j = 0;
      this.k = 0;
      this.d = new zat(var1, var2, var3);
      this.e = new zalw(var1, var4);
      this.h = true;
      this.i = var1.Z().a().a("dk1");
      this.a = com.aspose.cells.b.a.b.zp.a();
      this.b = com.aspose.cells.b.a.b.zp.a();
      this.r = var2;
      this.s = var3;
      this.g = new zxp();
   }

   zig a() {
      return this.c;
   }

   Object b() {
      return this.r;
   }

   zat c() {
      return this.d;
   }

   public zafn e() {
      return this.d;
   }

   zalw d() {
      return this.e;
   }

   public zahf g() {
      return this.e;
   }

   public com.aspose.cells.b.a.b.zg h() {
      com.aspose.cells.b.a.b.zg var1;
      if (this.f == null) {
         if (this.s == 0) {
            this.f = zbuk.a("Calibri", 10.0F, 0);
         } else {
            var1 = this.a().ac();
            switch(this.s) {
            case 8:
               int var2 = var1.k();
               var2 |= 1;
               this.f = zbuk.a(var1.g(), var1.h() * 1.2F, var2);
               break;
            case 9:
               int var3 = var1.k();
               var3 |= 1;
               this.f = zbuk.a(var1.g(), var1.h(), var3);
               break;
            default:
               this.f = zbuk.a(var1.g(), var1.h(), var1.k());
            }

            this.a(this.a().j().j());
         }
      }

      if (!this.k().d() && !this.k().c()) {
         return this.f;
      } else {
         var1 = new com.aspose.cells.b.a.b.zg(this.f.b(), 0.7F * this.f.h(), this.f.k());
         return var1;
      }
   }

   public void a(com.aspose.cells.b.a.b.zg var1) {
      this.f = var1;
   }

   com.aspose.cells.b.a.b.zg f() {
      if (this.f == null) {
         if (this.s == 0) {
            this.f = zbuk.a("Calibri", 10.0F, 0);
         } else {
            com.aspose.cells.b.a.b.zg var1 = this.a().ac();
            switch(this.s) {
            case 8:
               int var2 = var1.k();
               var2 |= 1;
               this.f = zbuk.a(var1.g(), var1.h() * 1.2F, var2);
               break;
            case 9:
               int var3 = var1.k();
               var3 |= 1;
               this.f = zbuk.a(var1.g(), var1.h(), var3);
               break;
            default:
               this.f = zbuk.a(var1.g(), var1.h(), var1.k());
            }

            this.a(this.a().j().j());
         }
      }

      return this.f;
   }

   void b(com.aspose.cells.b.a.b.zg var1) {
      this.f = var1;
   }

   public Color j() {
      if (this.h) {
         return this.a().R() > 40 ? this.a().Z().a().a("lt1") : this.a().Z().a().a("dk1");
      } else {
         return this.i;
      }
   }

   public void a(Color var1) {
      this.h = false;
      this.i = var1;
   }

   public zagt k() {
      return this.g;
   }

   public int l() {
      switch(this.s) {
      case 1:
      case 10:
         if (!this.s() && this.j + this.i() > 4000) {
            return 4000 - this.i();
         }

         return this.j;
      default:
         return this.j;
      }
   }

   public void a(int var1) {
      this.j = var1;
      this.p = false;
   }

   public int m() {
      switch(this.s) {
      case 1:
      case 10:
         if (!this.s() && this.k + this.n() > 4000) {
            return 4000 - this.n();
         }

         return this.k;
      default:
         return this.k;
      }
   }

   public void b(int var1) {
      this.k = var1;
      this.p = false;
   }

   public int i() {
      switch(this.s) {
      case 1:
      case 10:
         return this.l < 0 ? 0 : this.l;
      default:
         return this.l;
      }
   }

   public void c(int var1) {
      this.l = var1;
      this.n = false;
   }

   public int n() {
      switch(this.s) {
      case 1:
      case 10:
         return this.m < 0 ? 0 : this.m;
      default:
         return this.m;
      }
   }

   public void d(int var1) {
      this.m = var1;
      this.o = false;
   }

   public com.aspose.cells.b.a.b.zp o() {
      return new com.aspose.cells.b.a.b.zp(this.l, this.m, this.j, this.k);
   }

   public boolean q() {
      return this.n;
   }

   public void c(boolean var1) {
      this.n = var1;
   }

   public boolean p() {
      return this.o;
   }

   public void d(boolean var1) {
      this.o = var1;
   }

   public boolean s() {
      return this.p;
   }

   public void e(boolean var1) {
      this.p = var1;
   }

   com.aspose.cells.b.a.b.zs r() throws Exception {
      int var1 = this.l() * this.I() / this.K();
      int var2 = this.m() * this.J() / this.K();
      return new com.aspose.cells.b.a.b.zs(var1, var2);
   }

   int t() throws Exception {
      return this.l() * this.I() / this.K();
   }

   int u() throws Exception {
      return this.m() * this.J() / this.K();
   }

   int v() throws Exception {
      return this.i() * this.I() / this.K();
   }

   int w() throws Exception {
      return this.n() * this.J() / this.K();
   }

   public boolean x() {
      return this.q;
   }

   public void b(boolean var1) {
      this.q = var1;
   }

   int y() {
      int var1 = 14;
      if (this.s == 12) {
         if (this.r instanceof zbcq) {
            var1 = ((zbcq)this.r).ah();
         } else {
            var1 = ((zje)this.r).g().a().ah();
         }
      }

      return var1;
   }

   void z() throws Exception {
      this.a.a(this.b.c());
      this.a.b(this.b.d());
      this.a.c(this.b.e());
      this.a.d(this.b.f());
      int var1 = this.y();
      if (!this.p && this.s == 10) {
         com.aspose.cells.b.a.b.zs var2 = this.r();
         this.a.c(var2.b());
         this.a.d(var2.c());
      }

      int var3;
      if (!this.n) {
         if ((this.s != 12 || this.x()) && (this.s != 16 || this.x()) && (this.s != 8 || this.x()) && (this.s != 9 || this.x())) {
            if (this.s != 1) {
               var3 = this.v();
               this.a.a(var3 >= 0 ? var3 : 0);
               if (this.a.i() > this.c.a()) {
                  this.a.a(this.c.a() - this.a.e());
               }
            }
         } else {
            var3 = this.a.c();
            if (var1 == 6 && this.s == 12 && !this.F()) {
               var3 -= this.v();
            } else {
               var3 += this.v();
            }

            this.a.a(var3 >= 0 ? var3 : 0);
            if (this.a.i() > this.c.a()) {
               this.a.a(this.c.a() - this.a.e());
            }

            this.p = true;
         }
      }

      if (!this.o) {
         if (this.s == 12 && !this.x() || this.s == 16 && !this.x() || this.s == 8 && !this.x() || this.s == 9 && !this.x()) {
            var3 = this.a.d();
            var3 += this.w();
            this.a.b(var3 >= 0 ? var3 : 0);
            if (this.a.j() > this.c.b()) {
               this.a.b(this.c.b() - this.a.f());
            }
         } else if (this.s != 1) {
            var3 = this.w();
            this.a.b(var3 >= 0 ? var3 : 0);
            if (this.a.j() > this.c.b()) {
               this.a.b(this.c.b() - this.a.f());
            }
         }
      }

   }

   private int I() throws Exception {
      switch(this.s) {
      case 1:
      case 8:
      case 9:
      case 10:
      case 12:
      case 13:
      case 16:
         return this.c.ak().e();
      case 2:
      case 3:
      case 4:
      case 5:
      case 6:
      case 7:
      case 11:
      case 14:
      case 15:
      default:
         return this.t;
      }
   }

   private int J() throws Exception {
      switch(this.s) {
      case 1:
      case 8:
      case 9:
      case 10:
      case 12:
      case 13:
      case 16:
         return this.c.ak().f();
      case 2:
      case 3:
      case 4:
      case 5:
      case 6:
      case 7:
      case 11:
      case 14:
      case 15:
      default:
         return this.u;
      }
   }

   private int K() {
      switch(this.s) {
      case 1:
      case 8:
      case 9:
      case 10:
      case 12:
      case 13:
      case 16:
         return 4000;
      case 2:
      case 3:
      case 4:
      case 5:
      case 6:
      case 7:
      case 11:
      case 14:
      case 15:
      default:
         return this.v;
      }
   }

   com.aspose.cells.b.a.b.zp A() throws Exception {
      if (!this.C() && this.s != 1) {
         return this.o();
      } else {
         this.z();
         com.aspose.cells.b.a.b.zp var1 = new com.aspose.cells.b.a.b.zp(this.a.c(), this.a.d(), this.a.e(), this.a.f());
         int var2 = 14;
         if (this.s == 12) {
            if (this.r instanceof zbcq) {
               var2 = ((zbcq)this.r).ah();
            } else {
               var2 = ((zje)this.r).g().a().ah();
            }
         }

         if (this.s == 12) {
            if (var2 == 6) {
               var1.a(zbuk.c((double)this.K() * (double)var1.d() / (double)this.J()));
            } else {
               var1.a(zbuk.c((double)this.K() * (double)var1.c() / (double)this.I()));
            }
         } else {
            var1.a(zbuk.c((double)this.K() * (double)var1.c() / (double)this.I()));
         }

         if (this.s == 12) {
            if (var2 == 6) {
               var1.b(zbuk.c((double)this.K() * (double)var1.c() / (double)this.I()));
            } else {
               var1.b(zbuk.c((double)this.K() * (double)var1.d() / (double)this.J()));
            }
         } else {
            var1.b(zbuk.c((double)this.K() * (double)var1.d() / (double)this.J()));
         }

         var1.c(zbuk.c((double)this.K() * (double)var1.e() / (double)this.I()));
         var1.d(zbuk.c((double)this.K() * (double)var1.f() / (double)this.J()));
         return var1;
      }
   }

   com.aspose.cells.b.a.b.zp B() throws Exception {
      com.aspose.cells.b.a.b.zp var1 = new com.aspose.cells.b.a.b.zp(this.b.c(), this.b.d(), this.b.e(), this.b.f());
      var1.a(zbuk.c((double)this.K() * (double)var1.c() / (double)this.I()));
      var1.b(zbuk.c((double)this.K() * (double)var1.d() / (double)this.J()));
      var1.c(zbuk.c((double)this.K() * (double)var1.e() / (double)this.I()));
      var1.d(zbuk.c((double)this.K() * (double)var1.f() / (double)this.J()));
      return var1;
   }

   public boolean C() {
      return this.w;
   }

   public void a(boolean var1) {
      this.w = var1;
   }

   float D() {
      return (float)zbuk.a((double)this.a().ap().a().a(this.f()));
   }

   boolean E() throws Exception {
      this.z();
      return this.a.e() <= 0 || this.a.f() <= 0;
   }

   boolean F() {
      return this.x;
   }

   void f(boolean var1) {
      this.x = var1;
   }

   void G() throws Exception {
      if (!this.E()) {
         this.c().a(this.a);
         this.d().a(this.a);
      }
   }

   protected void finalize() throws Exception {
      this.g(false);
   }

   public void H() {
      this.g(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void g(boolean var1) {
      if (!this.y) {
         if (var1) {
            if (this.f != null) {
               this.f.n();
            }

            if (this.d != null) {
               this.d.l();
            }
         }

         this.y = true;
      }

   }
}
